//
//  YTStashScreenModel.m
//  YuTang
//
//  Created by 葛悦彣 on 2024/11/18.
//

#import "YTStashScreenModel.h"

@implementation YTStashScreenModel

- (NSString *)monthTime{
    if(!_monthTime){
        _monthTime = [NSDate br_stringFromDate:[NSDate new] dateFormat:@"yyyy-MM"];
    }
    return _monthTime;
}

- (NSMutableDictionary *)CRKSXDict{
    NSMutableDictionary * dict = [NSMutableDictionary dictionary];
    if(self.type.length > 0){
        [dict setObject:self.type forKey:@"type"];
    }
    if(self.createEndTime.length > 0){
        [dict setObject:self.createEndTime forKey:@"createEndTime"];
        [dict setObject:self.createStartTime forKey:@"createStartTime"];
    } else {
        [dict setObject:self.monthTime forKey:@"monthTime"];
    }
    
    
    [dict setObject:self.categoryId forKey:@"categoryId"];
    [dict setObject:self.createBy forKey:@"createBy"];
    [dict setObject:self.deliveryId forKey:@"deliveryId"];
    [dict setObject:self.categoryId forKey:@"categoryId"];

    return dict;
}

- (BOOL)isNew{
    if(self.createEndTime.length > 0){
        return YES;
    }
    if(self.categoryId.length > 0){
        return YES;
    }
    //////出入库类型 0:入库 1:出库

    if(![self.type isEqualToString:@"1"]){///非出库判断交货人
        if(self.deliveryId.length > 0){
           return YES;
       }
    }
    if(![self.type isEqualToString:@"0"]){///非入库判断领用人
        if(self.createBy.length > 0){
            return YES;
        }
    }
    return NO;
}
- (void)removeAllkey{
    self.createEndTime = @"";
    self.createStartTime = @"";
    self.categoryId = @"";
    self.categoryname = @"";
    self.createBy = @"";
    self.createByName = @"";
    self.deliveryId = @"";
    self.deliveryIdName = @"";
    self.monthTime = nil;

}
@end
